package cn.sitedev.hungry;

/**
 * @author qchen
 * @description 饿汉式单例
 * @date 2020/9/16 22:10
 */
public class Singleton2StaticBlock {

    private static Singleton2StaticBlock INSTANCE;

    // 类加载时就初始化实例
    static {
        INSTANCE = new Singleton2StaticBlock();
    }

    // 私有化构造器
    private Singleton2StaticBlock() {

    }

    // 全局唯一访问点
    public static Singleton2StaticBlock getInstance() {
        return INSTANCE;
    }
}
